package com.thrd.taiexhibition.model;

import com.alibaba.fastjson.JSON;
import com.thrd.basicframework.http.OkHttpUtils;
import com.thrd.basicframework.http.callback.ThrdCallBack;
import com.thrd.taiexhibition.bean.BeanHotActivityList;
import com.thrd.taiexhibition.callback.MvpCallback;
import com.thrd.taiexhibition.utils.Constant;

/**
 * @author: ${唐杰}
 * @date: 2021/3/25
 */
public class CityHotSpotModel {
    public static final String TAG="CityFocusModel";

    /**
     * 获取城市首页
     */
    public void getCityFocusData(long id,final MvpCallback<BeanHotActivityList> mvpCallback){
        OkHttpUtils.get().url(Constant.HTTP_CITY_HOTINFO)
                .tag(TAG)
                .addParams("cityId",String.valueOf(id))
                .build().execute(new ThrdCallBack<BeanHotActivityList>() {

            @Override
            public void onFailed(String e, int code) {
                mvpCallback.onFailed(e,code);
            }

            @Override
            public void onResponse(BeanHotActivityList response, int id) {
                mvpCallback.onSuccess(response);
            }

            @Override
            public BeanHotActivityList onJson(String s) {
                return JSON.parseObject(s, BeanHotActivityList.class);
            }


        });


    }
}
